<!DOCTYPE html>
<html lang="en-US" dir="ltr">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>一 、 字符/数组/对象处理 | 阿泽的笔记</title>
    <meta name="description" content="做一个努力的码农">
    <link rel="preload stylesheet" href="/assets/style.47519a3e.css" as="style">
    
    <script type="module" src="/assets/app.130cc073.js"></script>
    <link rel="preload" href="/assets/inter-roman-latin.2ed14f66.woff2" as="font" type="font/woff2" crossorigin="">
    <link rel="modulepreload" href="/assets/chunks/framework.cc795e4d.js">
    <link rel="modulepreload" href="/assets/chunks/theme.3ebce9b1.js">
    <link rel="modulepreload" href="/assets/tools_js知识点.md.51436346.lean.js">
    <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
    <script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
  </head>
  <body>
    <div id="app"><div class="Layout" data-v-5a346dfe><!--[--><!--]--><!--[--><span tabindex="-1" data-v-0f60ec36></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-0f60ec36> Skip to content </a><!--]--><!----><header class="VPNav" data-v-5a346dfe data-v-ae24b3ad><div class="VPNavBar has-sidebar" data-v-ae24b3ad data-v-a0fd61f4><div class="container" data-v-a0fd61f4><div class="title" data-v-a0fd61f4><div class="VPNavBarTitle has-sidebar" data-v-a0fd61f4 data-v-86d1bed8><a class="title" href="/" data-v-86d1bed8><!--[--><!--]--><!----><!--[-->阿泽的笔记<!--]--><!--[--><!--]--></a></div></div><div class="content" data-v-a0fd61f4><div class="curtain" data-v-a0fd61f4></div><div class="content-body" data-v-a0fd61f4><!--[--><!--]--><div class="VPNavBarSearch search" data-v-a0fd61f4><!----></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-a0fd61f4 data-v-7f418b0f><span id="main-nav-aria-label" class="visually-hidden" data-v-7f418b0f>Main Navigation</span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/" tabindex="0" data-v-7f418b0f data-v-42ef59de><!--[--><span data-v-42ef59de>首页</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/case/" tabindex="0" data-v-7f418b0f data-v-42ef59de><!--[--><span data-v-42ef59de>案例</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/tools/" tabindex="0" data-v-7f418b0f data-v-42ef59de><!--[--><span data-v-42ef59de>工具</span><!--]--></a><!--]--><!--]--></nav><!----><div class="VPNavBarAppearance appearance" data-v-a0fd61f4 data-v-e6aabb21><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="toggle dark mode" aria-checked="false" data-v-e6aabb21 data-v-ce54a7d1 data-v-b1685198><span class="check" data-v-b1685198><span class="icon" data-v-b1685198><!--[--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="sun" data-v-ce54a7d1><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="moon" data-v-ce54a7d1><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg><!--]--></span></span></button></div><!----><div class="VPFlyout VPNavBarExtra extra" data-v-a0fd61f4 data-v-40855f84 data-v-9c007e85><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-9c007e85><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="icon" data-v-9c007e85><circle cx="12" cy="12" r="2"></circle><circle cx="19" cy="12" r="2"></circle><circle cx="5" cy="12" r="2"></circle></svg></button><div class="menu" data-v-9c007e85><div class="VPMenu" data-v-9c007e85 data-v-e7ea1737><!----><!--[--><!--[--><!----><div class="group" data-v-40855f84><div class="item appearance" data-v-40855f84><p class="label" data-v-40855f84>Appearance</p><div class="appearance-action" data-v-40855f84><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="toggle dark mode" aria-checked="false" data-v-40855f84 data-v-ce54a7d1 data-v-b1685198><span class="check" data-v-b1685198><span class="icon" data-v-b1685198><!--[--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="sun" data-v-ce54a7d1><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="moon" data-v-ce54a7d1><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg><!--]--></span></span></button></div></div></div><!----><!--]--><!--]--></div></div></div><!--[--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-a0fd61f4 data-v-e5dd9c1c><span class="container" data-v-e5dd9c1c><span class="top" data-v-e5dd9c1c></span><span class="middle" data-v-e5dd9c1c></span><span class="bottom" data-v-e5dd9c1c></span></span></button></div></div></div></div><!----></header><div class="VPLocalNav reached-top" data-v-5a346dfe data-v-79c8c1df><button class="menu" aria-expanded="false" aria-controls="VPSidebarNav" data-v-79c8c1df><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="menu-icon" data-v-79c8c1df><path d="M17,11H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,11,17,11z"></path><path d="M21,7H3C2.4,7,2,6.6,2,6s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,7,21,7z"></path><path d="M21,15H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,15,21,15z"></path><path d="M17,19H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,19,17,19z"></path></svg><span class="menu-text" data-v-79c8c1df>Menu</span></button><div class="VPLocalNavOutlineDropdown" style="--vp-vh:0px;" data-v-79c8c1df data-v-1c15a60a><button data-v-1c15a60a>Return to top</button><!----></div></div><aside class="VPSidebar" data-v-5a346dfe data-v-b00e2fdd><div class="curtain" data-v-b00e2fdd></div><nav class="nav" id="VPSidebarNav" aria-labelledby="sidebar-aria-label" tabindex="-1" data-v-b00e2fdd><span class="visually-hidden" id="sidebar-aria-label" data-v-b00e2fdd> Sidebar Navigation </span><!--[--><!--]--><!--[--><div class="group" data-v-b00e2fdd><section class="VPSidebarItem level-0 collapsible has-active" data-v-b00e2fdd data-v-e31bd47b><div class="item" role="button" tabindex="0" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><h2 class="text" data-v-e31bd47b>工具</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-e31bd47b><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-e31bd47b><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-e31bd47b><!--[--><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/adb%E5%91%BD%E4%BB%A4.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>adb命令</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/arduino%E5%9F%BA%E7%A1%80%E6%93%8D%E4%BD%9C.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>arduino基础操作</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/cmd%20npm%20yarn%20pnpm%E5%91%BD%E4%BB%A4.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>cmd npm yarn pnpm命令</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/elementUi%E7%AC%94%E8%AE%B0.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>elementUi笔记</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/Emmet%20Web%E5%BF%AB%E9%80%9F%E6%9E%84%E5%BB%BA%E5%91%BD%E4%BB%A4.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>Emmet Web快速构建命令</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/git%E7%AC%94%E8%AE%B0.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>git笔记</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/js%E7%9F%A5%E8%AF%86%E7%82%B9.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>js知识点</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/linux%E5%91%BD%E4%BB%A4.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>linux命令</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/linux%E5%9F%9F%E5%90%8D%E9%85%8D%E7%BD%AE%E5%8F%8A%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>linux域名配置及反向代理</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/mac%E4%BD%BF%E7%94%A8%E7%AC%94%E8%AE%B0.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>mac使用笔记</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/mysql%E5%91%BD%E4%BB%A4.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>mysql命令</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/php%E5%9F%BA%E7%A1%80%E5%8F%8A%E5%B8%B8%E7%94%A8%E5%87%BD%E6%95%B0.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>php基础及常用函数</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/react.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>react</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/uniapp%E7%AC%94%E8%AE%B0.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>uniapp笔记</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/vue%E7%AC%94%E8%AE%B0.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>vue笔记</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/%E5%89%8D%E7%AB%AF%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>前端基础知识</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-b00e2fdd><section class="VPSidebarItem level-0 collapsible collapsed" data-v-b00e2fdd data-v-e31bd47b><div class="item" role="button" tabindex="0" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><h2 class="text" data-v-e31bd47b>案例</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-e31bd47b><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-e31bd47b><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-e31bd47b><!--[--><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/css%E6%8A%80%E5%B7%A7.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>css技巧</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/python%E8%87%AA%E5%8A%A8%E6%B5%8B%E8%AF%95%E8%84%9A%E6%9C%AC.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>python自动测试脚本</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/uniapp%E8%B8%A9%E5%9D%91%E8%AE%B0%E5%BD%95.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>uniapp踩坑记录</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/vuex%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>vuex使用示例</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/vue%E5%85%AD%E7%A7%8Dl%E4%BC%A0%E8%BE%93%E6%96%B9%E5%BC%8F.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>vue六种l传输方式</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/vue%E5%AE%9E%E4%BE%8B%E6%8A%80%E5%B7%A7.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>vue实例技巧</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/%E4%BC%98%E7%A7%80%E7%9A%84%E5%BC%80%E6%BA%90vue%E7%BB%84%E4%BB%B6.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>优秀的开源vue组件</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/%E5%89%8D%E7%AB%AF%E6%97%A5%E5%BF%97.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>前端日志</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/%E5%BC%80%E5%8F%91%E5%AF%8C%E6%96%87%E6%9C%AC%E6%9C%AC%E7%BC%96%E8%BE%91%E5%99%A8.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>开发富文本本编辑器</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/%E6%8F%92%E4%BB%B6%E4%BD%BF%E7%94%A8%E9%85%8D%E7%BD%AE.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>插件使用配置</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/%E6%A0%B7%E5%BC%8F%E5%B8%83%E5%B1%80.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>样式布局</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/%E8%BD%ACpdf%E7%9B%B8%E5%85%B3.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>转pdf相关</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><!--]--><!--[--><!--]--></nav></aside><div class="VPContent has-sidebar" id="VPContent" data-v-5a346dfe data-v-669faec9><div class="VPDoc has-sidebar has-aside" data-v-669faec9 data-v-6b87e69f><!--[--><!--]--><div class="container" data-v-6b87e69f><div class="aside" data-v-6b87e69f><div class="aside-curtain" data-v-6b87e69f></div><div class="aside-container" data-v-6b87e69f><div class="aside-content" data-v-6b87e69f><div class="VPDocAside" data-v-6b87e69f data-v-3f215769><!--[--><!--]--><!--[--><!--]--><div class="VPDocAsideOutline" role="navigation" data-v-3f215769 data-v-d330b1bb><div class="content" data-v-d330b1bb><div class="outline-marker" data-v-d330b1bb></div><div class="outline-title" role="heading" aria-level="2" data-v-d330b1bb>On this page</div><nav aria-labelledby="doc-outline-aria-label" data-v-d330b1bb><span class="visually-hidden" id="doc-outline-aria-label" data-v-d330b1bb> Table of Contents for current page </span><ul class="root" data-v-d330b1bb data-v-d0ee3533><!--[--><!--]--></ul></nav></div></div><!--[--><!--]--><div class="spacer" data-v-3f215769></div><!--[--><!--]--><!----><!--[--><!--]--><!--[--><!--]--></div></div></div></div><div class="content" data-v-6b87e69f><div class="content-container" data-v-6b87e69f><!--[--><!--]--><!----><main class="main" data-v-6b87e69f><div style="position:relative;" class="vp-doc _tools_js%E7%9F%A5%E8%AF%86%E7%82%B9" data-v-6b87e69f><div><h1 id="一-、-字符-数组-对象处理" tabindex="-1">一 、 字符/数组/对象处理 <a class="header-anchor" href="#一-、-字符-数组-对象处理" aria-label="Permalink to &quot;一 、 字符/数组/对象处理&quot;">​</a></h1><h2 id="_1-判断为空" tabindex="-1">1.判断为空 <a class="header-anchor" href="#_1-判断为空" aria-label="Permalink to &quot;1.判断为空&quot;">​</a></h2><div class="language-js vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;"> (variable1 </span><span style="color:#F97583;">!==</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">null</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">||</span><span style="color:#E1E4E8;"> variable1 </span><span style="color:#F97583;">!==</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">undefined</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">||</span><span style="color:#E1E4E8;"> variable1 </span><span style="color:#F97583;">!==</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;&#39;</span><span style="color:#E1E4E8;">) {</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">var</span><span style="color:#E1E4E8;"> variable2 </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> variable1;</span></span>
<span class="line"><span style="color:#E1E4E8;">	} </span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;"> (strings.</span><span style="color:#B392F0;">replace</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">/</span><span style="color:#DBEDFF;">(</span><span style="color:#F97583;">^</span><span style="color:#DBEDFF;">s</span><span style="color:#F97583;">*</span><span style="color:#DBEDFF;">)</span><span style="color:#F97583;">|</span><span style="color:#DBEDFF;">(s</span><span style="color:#F97583;">*$</span><span style="color:#DBEDFF;">)</span><span style="color:#9ECBFF;">/</span><span style="color:#F97583;">g</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&quot;&quot;</span><span style="color:#E1E4E8;">).</span><span style="color:#79B8FF;">length</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">==</span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">) </span></span>
<span class="line"><span style="color:#E1E4E8;">	{ </span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#B392F0;">alert</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;不能为空&#39;</span><span style="color:#E1E4E8;">); </span></span>
<span class="line"><span style="color:#E1E4E8;">	}</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">if</span><span style="color:#24292E;"> (variable1 </span><span style="color:#D73A49;">!==</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">null</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">||</span><span style="color:#24292E;"> variable1 </span><span style="color:#D73A49;">!==</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">undefined</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">||</span><span style="color:#24292E;"> variable1 </span><span style="color:#D73A49;">!==</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;&#39;</span><span style="color:#24292E;">) {</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">var</span><span style="color:#24292E;"> variable2 </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> variable1;</span></span>
<span class="line"><span style="color:#24292E;">	} </span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">if</span><span style="color:#24292E;"> (strings.</span><span style="color:#6F42C1;">replace</span><span style="color:#24292E;">(</span><span style="color:#032F62;">/(</span><span style="color:#D73A49;">^</span><span style="color:#032F62;">s</span><span style="color:#D73A49;">*</span><span style="color:#032F62;">)</span><span style="color:#D73A49;">|</span><span style="color:#032F62;">(s</span><span style="color:#D73A49;">*$</span><span style="color:#032F62;">)/</span><span style="color:#D73A49;">g</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&quot;&quot;</span><span style="color:#24292E;">).</span><span style="color:#005CC5;">length</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">==</span><span style="color:#005CC5;">0</span><span style="color:#24292E;">) </span></span>
<span class="line"><span style="color:#24292E;">	{ </span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#6F42C1;">alert</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;不能为空&#39;</span><span style="color:#24292E;">); </span></span>
<span class="line"><span style="color:#24292E;">	}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br></div></div><h2 id="_2-保留两位小数" tabindex="-1">2. 保留两位小数 <a class="header-anchor" href="#_2-保留两位小数" aria-label="Permalink to &quot;2. 保留两位小数&quot;">​</a></h2><div class="language-js vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">	a.</span><span style="color:#B392F0;">toFixed</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">2</span><span style="color:#E1E4E8;">)</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">	a.</span><span style="color:#6F42C1;">toFixed</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">2</span><span style="color:#24292E;">)</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br></div></div><h2 id="_3-数组及字符转换" tabindex="-1">3. 数组及字符转换 <a class="header-anchor" href="#_3-数组及字符转换" aria-label="Permalink to &quot;3.  数组及字符转换&quot;">​</a></h2><div class="language-js vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">	event.element.</span><span style="color:#B392F0;">attr</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;pid&#39;</span><span style="color:#E1E4E8;">).</span><span style="color:#B392F0;">split</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;|&quot;</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#6A737D;">//转数组</span></span>
<span class="line"><span style="color:#E1E4E8;">       a.</span><span style="color:#B392F0;">join</span><span style="color:#E1E4E8;">(sep)                   </span><span style="color:#6A737D;">//转字符串，每个元素通过指定符号分隔。</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">	event.element.</span><span style="color:#6F42C1;">attr</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;pid&#39;</span><span style="color:#24292E;">).</span><span style="color:#6F42C1;">split</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;|&quot;</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#6A737D;">//转数组</span></span>
<span class="line"><span style="color:#24292E;">       a.</span><span style="color:#6F42C1;">join</span><span style="color:#24292E;">(sep)                   </span><span style="color:#6A737D;">//转字符串，每个元素通过指定符号分隔。</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><h2 id="_4-过滤符合条件的数组" tabindex="-1">4, 过滤符合条件的数组 <a class="header-anchor" href="#_4-过滤符合条件的数组" aria-label="Permalink to &quot;4, 过滤符合条件的数组&quot;">​</a></h2><blockquote><p>（获取所有prolist中的status值为真的元素）</p></blockquote><div class="language-js vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#6A737D;">// 注意：filter() 方法创建一个新的数组，新数组中的元素是通过检查指定数组中符合条件的所有元素。并不改变原始数组</span></span>
<span class="line"><span style="color:#E1E4E8;">     newlist </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> prolist.</span><span style="color:#B392F0;">filter</span><span style="color:#E1E4E8;">(</span><span style="color:#F97583;">function</span><span style="color:#E1E4E8;">(</span><span style="color:#FFAB70;">item</span><span style="color:#E1E4E8;">){</span></span>
<span class="line"><span style="color:#E1E4E8;">					</span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> item.status;</span></span>
<span class="line"><span style="color:#E1E4E8;">				});	</span></span>
<span class="line"></span>
<span class="line"><span style="color:#6A737D;">// findIndex  根据条件查找第一个符合条件的下标</span></span>
<span class="line"><span style="color:#6A737D;">//map  遍历</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">    </span><span style="color:#6A737D;">// 注意：filter() 方法创建一个新的数组，新数组中的元素是通过检查指定数组中符合条件的所有元素。并不改变原始数组</span></span>
<span class="line"><span style="color:#24292E;">     newlist </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> prolist.</span><span style="color:#6F42C1;">filter</span><span style="color:#24292E;">(</span><span style="color:#D73A49;">function</span><span style="color:#24292E;">(</span><span style="color:#E36209;">item</span><span style="color:#24292E;">){</span></span>
<span class="line"><span style="color:#24292E;">					</span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> item.status;</span></span>
<span class="line"><span style="color:#24292E;">				});	</span></span>
<span class="line"></span>
<span class="line"><span style="color:#6A737D;">// findIndex  根据条件查找第一个符合条件的下标</span></span>
<span class="line"><span style="color:#6A737D;">//map  遍历</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br></div></div><h2 id="_5-删除数组中的元素" tabindex="-1">5. 删除数组中的元素 <a class="header-anchor" href="#_5-删除数组中的元素" aria-label="Permalink to &quot;5. 删除数组中的元素&quot;">​</a></h2><blockquote><p>（删除prolist中下标为index起共一个元素）</p></blockquote><div class="language-js vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#6A737D;">//注意 splice() 方法用于插入、删除或替换数组的元素。这种方法会改变原始数组！。</span></span>
<span class="line"><span style="color:#E1E4E8;">     prolist.</span><span style="color:#B392F0;">splice</span><span style="color:#E1E4E8;">(index,</span><span style="color:#79B8FF;">1</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#9ECBFF;">```## 6. 添加数组 </span></span>
<span class="line"><span style="color:#9ECBFF;">```</span><span style="color:#E1E4E8;">js </span></span>
<span class="line"><span style="color:#E1E4E8;">fruits.</span><span style="color:#B392F0;">push</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;Kiwi&quot;</span><span style="color:#E1E4E8;">) ;    </span><span style="color:#6A737D;">//添加元素 </span></span>
<span class="line"><span style="color:#F97583;">var</span><span style="color:#E1E4E8;"> newArr </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> arr.</span><span style="color:#B392F0;">concat</span><span style="color:#E1E4E8;">(arr2); </span><span style="color:#6A737D;">//数组拼接</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">    </span><span style="color:#6A737D;">//注意 splice() 方法用于插入、删除或替换数组的元素。这种方法会改变原始数组！。</span></span>
<span class="line"><span style="color:#24292E;">     prolist.</span><span style="color:#6F42C1;">splice</span><span style="color:#24292E;">(index,</span><span style="color:#005CC5;">1</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#032F62;">```## 6. 添加数组 </span></span>
<span class="line"><span style="color:#032F62;">```</span><span style="color:#24292E;">js </span></span>
<span class="line"><span style="color:#24292E;">fruits.</span><span style="color:#6F42C1;">push</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;Kiwi&quot;</span><span style="color:#24292E;">) ;    </span><span style="color:#6A737D;">//添加元素 </span></span>
<span class="line"><span style="color:#D73A49;">var</span><span style="color:#24292E;"> newArr </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> arr.</span><span style="color:#6F42C1;">concat</span><span style="color:#24292E;">(arr2); </span><span style="color:#6A737D;">//数组拼接</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><h2 id="_7-查看对象属性" tabindex="-1">7. 查看对象属性 <a class="header-anchor" href="#_7-查看对象属性" aria-label="Permalink to &quot;7. 查看对象属性&quot;">​</a></h2><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">var func=function(){</span></span>
<span class="line"><span style="color:#e1e4e8;">}</span></span>
<span class="line"><span style="color:#e1e4e8;">typeof func</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">var func=function(){</span></span>
<span class="line"><span style="color:#24292e;">}</span></span>
<span class="line"><span style="color:#24292e;">typeof func</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><h2 id="_8-按钮拷贝文本" tabindex="-1">8. 按钮拷贝文本 <a class="header-anchor" href="#_8-按钮拷贝文本" aria-label="Permalink to &quot;8. 按钮拷贝文本&quot;">​</a></h2><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;"> //复制内容到剪切板</span></span>
<span class="line"><span style="color:#e1e4e8;">  copyText: function (text) {</span></span>
<span class="line"><span style="color:#e1e4e8;">    var input = document.createElement(&quot;input&quot;); // 创建input对象</span></span>
<span class="line"><span style="color:#e1e4e8;">    input.value = text; // 设置复制内容</span></span>
<span class="line"><span style="color:#e1e4e8;">    document.body.appendChild(input); // 添加临时实例</span></span>
<span class="line"><span style="color:#e1e4e8;">    input.select(); // 选择实例内容</span></span>
<span class="line"><span style="color:#e1e4e8;">    document.execCommand(&quot;Copy&quot;); // 执行复制</span></span>
<span class="line"><span style="color:#e1e4e8;">    document.body.removeChild(input); // 删除临时实例</span></span>
<span class="line"><span style="color:#e1e4e8;">  },</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;"> //复制内容到剪切板</span></span>
<span class="line"><span style="color:#24292e;">  copyText: function (text) {</span></span>
<span class="line"><span style="color:#24292e;">    var input = document.createElement(&quot;input&quot;); // 创建input对象</span></span>
<span class="line"><span style="color:#24292e;">    input.value = text; // 设置复制内容</span></span>
<span class="line"><span style="color:#24292e;">    document.body.appendChild(input); // 添加临时实例</span></span>
<span class="line"><span style="color:#24292e;">    input.select(); // 选择实例内容</span></span>
<span class="line"><span style="color:#24292e;">    document.execCommand(&quot;Copy&quot;); // 执行复制</span></span>
<span class="line"><span style="color:#24292e;">    document.body.removeChild(input); // 删除临时实例</span></span>
<span class="line"><span style="color:#24292e;">  },</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br></div></div><h2 id="_9-验证特殊字符" tabindex="-1">9. 验证特殊字符 <a class="header-anchor" href="#_9-验证特殊字符" aria-label="Permalink to &quot;9. 验证特殊字符&quot;">​</a></h2><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">let str = &#39;223%3sdfsdfas我们&#39;;</span></span>
<span class="line"><span style="color:#e1e4e8;">if(/[^\u4E00-\u9FA5A-Za-z0-9]/g.test(str)){</span></span>
<span class="line"><span style="color:#e1e4e8;">	console.log(&#39;验证不通过&#39;)</span></span>
<span class="line"><span style="color:#e1e4e8;">}else{</span></span>
<span class="line"><span style="color:#e1e4e8;">  console.log(&#39;合格&#39;)</span></span>
<span class="line"><span style="color:#e1e4e8;">}</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">let str = &#39;223%3sdfsdfas我们&#39;;</span></span>
<span class="line"><span style="color:#24292e;">if(/[^\u4E00-\u9FA5A-Za-z0-9]/g.test(str)){</span></span>
<span class="line"><span style="color:#24292e;">	console.log(&#39;验证不通过&#39;)</span></span>
<span class="line"><span style="color:#24292e;">}else{</span></span>
<span class="line"><span style="color:#24292e;">  console.log(&#39;合格&#39;)</span></span>
<span class="line"><span style="color:#24292e;">}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><h3 id="从给定文本中剥离html" tabindex="-1">从给定文本中剥离html <a class="header-anchor" href="#从给定文本中剥离html" aria-label="Permalink to &quot;从给定文本中剥离html&quot;">​</a></h3><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">const stripHtml = (html) =&gt; new DOMParser().parseFromString(html, &#39;text/html&#39;).body.textContent || &#39;&#39;;</span></span>
<span class="line"><span style="color:#e1e4e8;">stripHtml(&#39;&lt;div&gt;test&lt;/div&gt;&#39;) // &#39;test&#39;</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">const stripHtml = (html) =&gt; new DOMParser().parseFromString(html, &#39;text/html&#39;).body.textContent || &#39;&#39;;</span></span>
<span class="line"><span style="color:#24292e;">stripHtml(&#39;&lt;div&gt;test&lt;/div&gt;&#39;) // &#39;test&#39;</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h3 id="强制等待" tabindex="-1">强制等待 <a class="header-anchor" href="#强制等待" aria-label="Permalink to &quot;强制等待&quot;">​</a></h3><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">const sleep = async (t) =&gt; new Promise((resolve) =&gt; setTimeout(resolve, t));</span></span>
<span class="line"><span style="color:#e1e4e8;">sleep(2000).then(() =&gt; {console.log(&#39;time&#39;)});</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">const sleep = async (t) =&gt; new Promise((resolve) =&gt; setTimeout(resolve, t));</span></span>
<span class="line"><span style="color:#24292e;">sleep(2000).then(() =&gt; {console.log(&#39;time&#39;)});</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h2 id="正则表达式处理" tabindex="-1">正则表达式处理 <a class="header-anchor" href="#正则表达式处理" aria-label="Permalink to &quot;正则表达式处理&quot;">​</a></h2><p>方式1：</p><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">var reg = new RegExp(&#39;\d&#39;, &#39;i&#39;);</span></span>
<span class="line"><span style="color:#e1e4e8;">var reg = new RegExp(&#39;\d&#39;, &#39;gi&#39;);</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">var reg = new RegExp(&#39;\d&#39;, &#39;i&#39;);</span></span>
<span class="line"><span style="color:#24292e;">var reg = new RegExp(&#39;\d&#39;, &#39;gi&#39;);</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p>方式2：</p><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">var reg = /\d/i;</span></span>
<span class="line"><span style="color:#e1e4e8;">var reg = /\d/gi;</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">var reg = /\d/i;</span></span>
<span class="line"><span style="color:#24292e;">var reg = /\d/gi;</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p>常用方法</p><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">//普通替换</span></span>
<span class="line"><span style="color:#e1e4e8;">words.replace(senstive_words[i].con,&#39;**&#39;);  </span></span>
<span class="line"><span style="color:#e1e4e8;">//回调方法f</span></span>
<span class="line"><span style="color:#e1e4e8;">let patt = new RegExp(</span></span>
<span class="line"><span style="color:#e1e4e8;">          /&lt;span data-w-e-type=\&quot;formula\&quot; data-w-e-is-void(=&quot;&quot;)? data-w-e-is-inline(=&quot;&quot;)? data-value=\&quot;([\s\S]*?)\&quot;&gt;&lt;\/span&gt;/g</span></span>
<span class="line"><span style="color:#e1e4e8;">        );</span></span>
<span class="line"><span style="color:#e1e4e8;">newContent = newContent.replace(patt,(match,arg1,arg2,arg3)=&gt;{ //</span></span>
<span class="line"><span style="color:#e1e4e8;">	let str = arg3.replace(&quot;\f&quot;, &quot;\\f&quot;);</span></span>
<span class="line"><span style="color:#e1e4e8;">	str = str.replace(/&amp;nbsp;/g, &quot;\\space &quot;);</span></span>
<span class="line"><span style="color:#e1e4e8;">	return &#39;$&#39;+str+&#39;$&#39;;</span></span>
<span class="line"><span style="color:#e1e4e8;">})</span></span>
<span class="line"><span style="color:#e1e4e8;"></span></span>
<span class="line"><span style="color:#e1e4e8;">//判断</span></span>
<span class="line"><span style="color:#e1e4e8;">let pattern = new RegExp(senstive_words[i].con,&quot;g&quot;);</span></span>
<span class="line"><span style="color:#e1e4e8;">		if(pattern.test(words)){</span></span>
<span class="line"><span style="color:#e1e4e8;">			return true;</span></span>
<span class="line"><span style="color:#e1e4e8;">		}</span></span>
<span class="line"><span style="color:#e1e4e8;">//取值</span></span>
<span class="line"><span style="color:#e1e4e8;">m = re.search(r&#39;\\w{8,20}&#39;)  //返回索引</span></span>
<span class="line"><span style="color:#e1e4e8;">m = re.match(r&#39;\\w{8,20}&#39;)   //返回数组</span></span>
<span class="line"><span style="color:#e1e4e8;"></span></span>
<span class="line"><span style="color:#e1e4e8;">//exec</span></span>
<span class="line"><span style="color:#e1e4e8;">let patt = new RegExp(/&lt;span data-w-e-type=\&quot;formula\&quot; data-w-e-is-void data-w-e-is-inline data-value=\&quot;([\s\S]*?)\&quot;&gt;&lt;\/span&gt;/g); </span></span>
<span class="line"><span style="color:#e1e4e8;">while (r = patt.exec(html)) { </span></span>
<span class="line"><span style="color:#e1e4e8;">	html_new = html_new.replace(r[0], w);</span></span>
<span class="line"><span style="color:#e1e4e8;">}</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">//普通替换</span></span>
<span class="line"><span style="color:#24292e;">words.replace(senstive_words[i].con,&#39;**&#39;);  </span></span>
<span class="line"><span style="color:#24292e;">//回调方法f</span></span>
<span class="line"><span style="color:#24292e;">let patt = new RegExp(</span></span>
<span class="line"><span style="color:#24292e;">          /&lt;span data-w-e-type=\&quot;formula\&quot; data-w-e-is-void(=&quot;&quot;)? data-w-e-is-inline(=&quot;&quot;)? data-value=\&quot;([\s\S]*?)\&quot;&gt;&lt;\/span&gt;/g</span></span>
<span class="line"><span style="color:#24292e;">        );</span></span>
<span class="line"><span style="color:#24292e;">newContent = newContent.replace(patt,(match,arg1,arg2,arg3)=&gt;{ //</span></span>
<span class="line"><span style="color:#24292e;">	let str = arg3.replace(&quot;\f&quot;, &quot;\\f&quot;);</span></span>
<span class="line"><span style="color:#24292e;">	str = str.replace(/&amp;nbsp;/g, &quot;\\space &quot;);</span></span>
<span class="line"><span style="color:#24292e;">	return &#39;$&#39;+str+&#39;$&#39;;</span></span>
<span class="line"><span style="color:#24292e;">})</span></span>
<span class="line"><span style="color:#24292e;"></span></span>
<span class="line"><span style="color:#24292e;">//判断</span></span>
<span class="line"><span style="color:#24292e;">let pattern = new RegExp(senstive_words[i].con,&quot;g&quot;);</span></span>
<span class="line"><span style="color:#24292e;">		if(pattern.test(words)){</span></span>
<span class="line"><span style="color:#24292e;">			return true;</span></span>
<span class="line"><span style="color:#24292e;">		}</span></span>
<span class="line"><span style="color:#24292e;">//取值</span></span>
<span class="line"><span style="color:#24292e;">m = re.search(r&#39;\\w{8,20}&#39;)  //返回索引</span></span>
<span class="line"><span style="color:#24292e;">m = re.match(r&#39;\\w{8,20}&#39;)   //返回数组</span></span>
<span class="line"><span style="color:#24292e;"></span></span>
<span class="line"><span style="color:#24292e;">//exec</span></span>
<span class="line"><span style="color:#24292e;">let patt = new RegExp(/&lt;span data-w-e-type=\&quot;formula\&quot; data-w-e-is-void data-w-e-is-inline data-value=\&quot;([\s\S]*?)\&quot;&gt;&lt;\/span&gt;/g); </span></span>
<span class="line"><span style="color:#24292e;">while (r = patt.exec(html)) { </span></span>
<span class="line"><span style="color:#24292e;">	html_new = html_new.replace(r[0], w);</span></span>
<span class="line"><span style="color:#24292e;">}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br></div></div><h1 id="二、-页面操作" tabindex="-1">二、 页面操作 <a class="header-anchor" href="#二、-页面操作" aria-label="Permalink to &quot;二、 页面操作&quot;">​</a></h1><div class="language-javascript vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">javascript</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">	window.</span><span style="color:#B392F0;">open</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;demo3.php&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&#39;统计学&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&#39;height=20;width=30;screenX:20;screenY:10;toolbar:yes;&#39;</span><span style="color:#E1E4E8;">);</span><span style="color:#6A737D;">//打开新窗口</span></span>
<span class="line"><span style="color:#E1E4E8;">	window.</span><span style="color:#B392F0;">open</span><span style="color:#E1E4E8;">(url, </span><span style="color:#9ECBFF;">&quot;_blank&quot;</span><span style="color:#E1E4E8;">); </span><span style="color:#6A737D;">//新页面打开 tde</span></span>
<span class="line"><span style="color:#E1E4E8;">	onclick</span><span style="color:#F97583;">=</span><span style="color:#9ECBFF;">&quot;history.forward();&quot;</span><span style="color:#E1E4E8;">  </span><span style="color:#6A737D;">//页面前进</span></span>
<span class="line"><span style="color:#E1E4E8;">	onclick</span><span style="color:#F97583;">=</span><span style="color:#9ECBFF;">&quot;history.back();&quot;</span><span style="color:#E1E4E8;">     </span><span style="color:#6A737D;">//页面后退</span></span>
<span class="line"><span style="color:#E1E4E8;">	onclick</span><span style="color:#F97583;">=</span><span style="color:#9ECBFF;">&quot;closewindow();&quot;</span><span style="color:#E1E4E8;">      </span><span style="color:#6A737D;">//关闭窗口</span></span>
<span class="line"><span style="color:#E1E4E8;">	onclick</span><span style="color:#F97583;">=</span><span style="color:#9ECBFF;">&quot;document.location.reload();&quot;</span><span style="color:#E1E4E8;"> </span><span style="color:#6A737D;">//当前页面重新加载</span></span>
<span class="line"><span style="color:#E1E4E8;">	onclick</span><span style="color:#F97583;">=</span><span style="color:#9ECBFF;">&quot;window.print();&quot;</span><span style="color:#E1E4E8;">    </span><span style="color:#6A737D;">//打印页面</span></span>
<span class="line"><span style="color:#E1E4E8;">	window.location.href</span><span style="color:#F97583;">=</span><span style="color:#9ECBFF;">&quot;jb51.jsp&quot;</span><span style="color:#E1E4E8;">; </span><span style="color:#6A737D;">//跳转页面</span></span>
<span class="line"><span style="color:#E1E4E8;">	window.</span><span style="color:#B392F0;">open</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;weixin://&quot;</span><span style="color:#E1E4E8;">);   </span><span style="color:#6A737D;">//跳转微信页面</span></span>
<span class="line"><span style="color:#E1E4E8;">	window.frames[</span><span style="color:#9ECBFF;">&#39;myiframe&#39;</span><span style="color:#E1E4E8;">].window.</span><span style="color:#B392F0;">open</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;http://www.sina.com&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&#39;myiframe&#39;</span><span style="color:#E1E4E8;">);	</span><span style="color:#6A737D;">//iframe框架根据条件更改页面指向</span></span>
<span class="line"><span style="color:#E1E4E8;">	document.</span><span style="color:#B392F0;">getElementById</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;content&#39;</span><span style="color:#E1E4E8;">).offsetHeight;  </span><span style="color:#6A737D;">//获取div高度</span></span>
<span class="line"><span style="color:#E1E4E8;">	document.body.scrollHeight                   </span><span style="color:#6A737D;">//网页正文全文高：</span></span>
<span class="line"><span style="color:#E1E4E8;">	text </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> window.clipboardData.</span><span style="color:#B392F0;">getData</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;Text&#39;</span><span style="color:#E1E4E8;">); </span><span style="color:#6A737D;">// 获取剪切板text 格式的数据 </span></span>
<span class="line"><span style="color:#E1E4E8;">	text_basic</span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;">window.clipboardData.</span><span style="color:#B392F0;">setData</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;Text&quot;</span><span style="color:#E1E4E8;">,tt);</span><span style="color:#6A737D;">//复制内容到剪切板 text格式的数据</span></span>
<span class="line"><span style="color:#E1E4E8;">	onKeyDown</span><span style="color:#F97583;">=</span><span style="color:#9ECBFF;">&quot;if(event.keyCode==13)event.keyCode=9&quot;</span><span style="color:#E1E4E8;">   </span><span style="color:#6A737D;">//如果回车按键事件</span></span>
<span class="line"><span style="color:#E1E4E8;">	&lt;</span><span style="color:#85E89D;">body</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">oncontextmenu</span><span style="color:#FDAEB7;font-style:italic;">=return(false)&gt;//彻底屏蔽鼠标右键</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#FDAEB7;font-style:italic;">&lt;input</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">type</span><span style="color:#F97583;">=</span><span style="color:#9ECBFF;">&quot;submit&quot;</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">onclick</span><span style="color:#F97583;">=</span><span style="color:#9ECBFF;">&quot;return window.confirm(&#39;是否确认提交&#39;)?ture : false;&quot;</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">value</span><span style="color:#F97583;">=</span><span style="color:#9ECBFF;">&quot;提交&quot;</span><span style="color:#E1E4E8;"> &gt;&lt;</span><span style="color:#85E89D;">br</span><span style="color:#E1E4E8;">/&gt;   //确认提交</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">	window.</span><span style="color:#6F42C1;">open</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;demo3.php&#39;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&#39;统计学&#39;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&#39;height=20;width=30;screenX:20;screenY:10;toolbar:yes;&#39;</span><span style="color:#24292E;">);</span><span style="color:#6A737D;">//打开新窗口</span></span>
<span class="line"><span style="color:#24292E;">	window.</span><span style="color:#6F42C1;">open</span><span style="color:#24292E;">(url, </span><span style="color:#032F62;">&quot;_blank&quot;</span><span style="color:#24292E;">); </span><span style="color:#6A737D;">//新页面打开 tde</span></span>
<span class="line"><span style="color:#24292E;">	onclick</span><span style="color:#D73A49;">=</span><span style="color:#032F62;">&quot;history.forward();&quot;</span><span style="color:#24292E;">  </span><span style="color:#6A737D;">//页面前进</span></span>
<span class="line"><span style="color:#24292E;">	onclick</span><span style="color:#D73A49;">=</span><span style="color:#032F62;">&quot;history.back();&quot;</span><span style="color:#24292E;">     </span><span style="color:#6A737D;">//页面后退</span></span>
<span class="line"><span style="color:#24292E;">	onclick</span><span style="color:#D73A49;">=</span><span style="color:#032F62;">&quot;closewindow();&quot;</span><span style="color:#24292E;">      </span><span style="color:#6A737D;">//关闭窗口</span></span>
<span class="line"><span style="color:#24292E;">	onclick</span><span style="color:#D73A49;">=</span><span style="color:#032F62;">&quot;document.location.reload();&quot;</span><span style="color:#24292E;"> </span><span style="color:#6A737D;">//当前页面重新加载</span></span>
<span class="line"><span style="color:#24292E;">	onclick</span><span style="color:#D73A49;">=</span><span style="color:#032F62;">&quot;window.print();&quot;</span><span style="color:#24292E;">    </span><span style="color:#6A737D;">//打印页面</span></span>
<span class="line"><span style="color:#24292E;">	window.location.href</span><span style="color:#D73A49;">=</span><span style="color:#032F62;">&quot;jb51.jsp&quot;</span><span style="color:#24292E;">; </span><span style="color:#6A737D;">//跳转页面</span></span>
<span class="line"><span style="color:#24292E;">	window.</span><span style="color:#6F42C1;">open</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;weixin://&quot;</span><span style="color:#24292E;">);   </span><span style="color:#6A737D;">//跳转微信页面</span></span>
<span class="line"><span style="color:#24292E;">	window.frames[</span><span style="color:#032F62;">&#39;myiframe&#39;</span><span style="color:#24292E;">].window.</span><span style="color:#6F42C1;">open</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;http://www.sina.com&#39;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&#39;myiframe&#39;</span><span style="color:#24292E;">);	</span><span style="color:#6A737D;">//iframe框架根据条件更改页面指向</span></span>
<span class="line"><span style="color:#24292E;">	document.</span><span style="color:#6F42C1;">getElementById</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;content&#39;</span><span style="color:#24292E;">).offsetHeight;  </span><span style="color:#6A737D;">//获取div高度</span></span>
<span class="line"><span style="color:#24292E;">	document.body.scrollHeight                   </span><span style="color:#6A737D;">//网页正文全文高：</span></span>
<span class="line"><span style="color:#24292E;">	text </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> window.clipboardData.</span><span style="color:#6F42C1;">getData</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;Text&#39;</span><span style="color:#24292E;">); </span><span style="color:#6A737D;">// 获取剪切板text 格式的数据 </span></span>
<span class="line"><span style="color:#24292E;">	text_basic</span><span style="color:#D73A49;">=</span><span style="color:#24292E;">window.clipboardData.</span><span style="color:#6F42C1;">setData</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;Text&quot;</span><span style="color:#24292E;">,tt);</span><span style="color:#6A737D;">//复制内容到剪切板 text格式的数据</span></span>
<span class="line"><span style="color:#24292E;">	onKeyDown</span><span style="color:#D73A49;">=</span><span style="color:#032F62;">&quot;if(event.keyCode==13)event.keyCode=9&quot;</span><span style="color:#24292E;">   </span><span style="color:#6A737D;">//如果回车按键事件</span></span>
<span class="line"><span style="color:#24292E;">	&lt;</span><span style="color:#22863A;">body</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">oncontextmenu</span><span style="color:#B31D28;font-style:italic;">=return(false)&gt;//彻底屏蔽鼠标右键</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#B31D28;font-style:italic;">&lt;input</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">type</span><span style="color:#D73A49;">=</span><span style="color:#032F62;">&quot;submit&quot;</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">onclick</span><span style="color:#D73A49;">=</span><span style="color:#032F62;">&quot;return window.confirm(&#39;是否确认提交&#39;)?ture : false;&quot;</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">value</span><span style="color:#D73A49;">=</span><span style="color:#032F62;">&quot;提交&quot;</span><span style="color:#24292E;"> &gt;&lt;</span><span style="color:#22863A;">br</span><span style="color:#24292E;">/&gt;   //确认提交</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br></div></div><h1 id="三、-dom操作" tabindex="-1">三、 DOM操作 <a class="header-anchor" href="#三、-dom操作" aria-label="Permalink to &quot;三、 DOM操作&quot;">​</a></h1><h2 id="获取节点" tabindex="-1">获取节点 <a class="header-anchor" href="#获取节点" aria-label="Permalink to &quot;获取节点&quot;">​</a></h2><h3 id="_1-1-根据id获取节点" tabindex="-1">1.1 根据ID获取节点： <a class="header-anchor" href="#_1-1-根据id获取节点" aria-label="Permalink to &quot;1.1 根据ID获取节点：&quot;">​</a></h3><p>var test = document.getElementById(&#39;test&#39;);</p><h3 id="_1-2-根据标签获取节点" tabindex="-1">1.2 根据标签获取节点： <a class="header-anchor" href="#_1-2-根据标签获取节点" aria-label="Permalink to &quot;1.2 根据标签获取节点：&quot;">​</a></h3><p>var trs = document.getElementsByTagName(&#39;tr&#39;);</p><h3 id="_1-3-根据类名获取节点" tabindex="-1">1.3 根据类名获取节点： <a class="header-anchor" href="#_1-3-根据类名获取节点" aria-label="Permalink to &quot;1.3 根据类名获取节点：&quot;">​</a></h3><p>var reds = document.getElementsByClassName(&#39;red&#39;);</p><h3 id="_1-4-获取节点test下的所有直属子节点" tabindex="-1">1.4. 获取节点test下的所有直属子节点 <a class="header-anchor" href="#_1-4-获取节点test下的所有直属子节点" aria-label="Permalink to &quot;1.4. 获取节点test下的所有直属子节点&quot;">​</a></h3><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark has-highlighted-lines vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">var cs = test.children; </span></span>
<span class="line"><span style="color:#e1e4e8;">1.6 获取节点test下第一个、最后一个子节点：</span></span>
<span class="line"><span style="color:#e1e4e8;">var first = test.firstElementChild;</span></span>
<span class="line"><span style="color:#e1e4e8;">var last = test.lastElementChild; </span></span>
<span class="line"><span style="color:#e1e4e8;">1.7  通过querySelector获取ID为q1的节点：</span></span>
<span class="line"><span style="color:#e1e4e8;">var q1 = document.querySelector(&#39;#q1&#39;); </span></span>
<span class="line"><span style="color:#e1e4e8;">1.8 通过querySelectorAll获取q1节点内的符合条件的所有节点：</span></span>
<span class="line"><span style="color:#e1e4e8;">var ps = q1.querySelectorAll(&#39;div.highlighted &gt; p&#39;);</span></span>
<span class="line"><span style="color:#e1e4e8;">1.9 利用下标获取节点</span></span>
<span class="line"><span style="color:#e1e4e8;">var arr = document.getElementsByClassName(&#39;c-red&#39;)[1].children;</span></span>
<span class="line"><span style="color:#e1e4e8;">1.10 子节点长度</span></span>
<span class="line"><span style="color:#e1e4e8;">var len=main.childNodes.length;</span></span></code></pre><pre class="shiki github-light has-highlighted-lines vp-code-light"><code><span class="line"><span style="color:#24292e;">var cs = test.children; </span></span>
<span class="line"><span style="color:#24292e;">1.6 获取节点test下第一个、最后一个子节点：</span></span>
<span class="line"><span style="color:#24292e;">var first = test.firstElementChild;</span></span>
<span class="line"><span style="color:#24292e;">var last = test.lastElementChild; </span></span>
<span class="line"><span style="color:#24292e;">1.7  通过querySelector获取ID为q1的节点：</span></span>
<span class="line"><span style="color:#24292e;">var q1 = document.querySelector(&#39;#q1&#39;); </span></span>
<span class="line"><span style="color:#24292e;">1.8 通过querySelectorAll获取q1节点内的符合条件的所有节点：</span></span>
<span class="line"><span style="color:#24292e;">var ps = q1.querySelectorAll(&#39;div.highlighted &gt; p&#39;);</span></span>
<span class="line"><span style="color:#24292e;">1.9 利用下标获取节点</span></span>
<span class="line"><span style="color:#24292e;">var arr = document.getElementsByClassName(&#39;c-red&#39;)[1].children;</span></span>
<span class="line"><span style="color:#24292e;">1.10 子节点长度</span></span>
<span class="line"><span style="color:#24292e;">var len=main.childNodes.length;</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br></div></div><ol start="2"><li>添加监听事件 document.getElementById(&#39;pack-down&#39;).addEventListener(&#39;click&#39;,function(){ document.getElementById(&#39;pay-btn&#39;).click(); })</li><li>跳转到指定位置 document.getElementById(&#39;ask_list&#39;).scrollIntoView();</li></ol><h3 id="_1-5-获取指定元素的页面位置" tabindex="-1">1.5 获取指定元素的页面位置 <a class="header-anchor" href="#_1-5-获取指定元素的页面位置" aria-label="Permalink to &quot;1.5 获取指定元素的页面位置&quot;">​</a></h3><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">getPosition:function(node) {</span></span>
<span class="line"><span style="color:#e1e4e8;">					//获取元素相对于其父元素的left值var left</span></span>
<span class="line"><span style="color:#e1e4e8;">      var left = node.offsetLeft;</span></span>
<span class="line"><span style="color:#e1e4e8;">      var top = node.offsetTop;</span></span>
<span class="line"><span style="color:#e1e4e8;">      // 取得元素的offsetParent</span></span>
<span class="line"><span style="color:#e1e4e8;">      let current = node.offsetParent;</span></span>
<span class="line"><span style="color:#e1e4e8;"></span></span>
<span class="line"><span style="color:#e1e4e8;">      　 // 一直循环直到根元素</span></span>
<span class="line"><span style="color:#e1e4e8;">      while(current != null) {　　</span></span>
<span class="line"><span style="color:#e1e4e8;">          left += current.offsetLeft;　　</span></span>
<span class="line"><span style="color:#e1e4e8;">          top += current.offsetTop;　　</span></span>
<span class="line"><span style="color:#e1e4e8;">          current = current.offsetParent;　</span></span>
<span class="line"><span style="color:#e1e4e8;">      }</span></span>
<span class="line"><span style="color:#e1e4e8;">      return {</span></span>
<span class="line"><span style="color:#e1e4e8;">          &quot;left&quot;: left,</span></span>
<span class="line"><span style="color:#e1e4e8;">          &quot;top&quot;: top</span></span>
<span class="line"><span style="color:#e1e4e8;">      };</span></span>
<span class="line"><span style="color:#e1e4e8;">    }</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">getPosition:function(node) {</span></span>
<span class="line"><span style="color:#24292e;">					//获取元素相对于其父元素的left值var left</span></span>
<span class="line"><span style="color:#24292e;">      var left = node.offsetLeft;</span></span>
<span class="line"><span style="color:#24292e;">      var top = node.offsetTop;</span></span>
<span class="line"><span style="color:#24292e;">      // 取得元素的offsetParent</span></span>
<span class="line"><span style="color:#24292e;">      let current = node.offsetParent;</span></span>
<span class="line"><span style="color:#24292e;"></span></span>
<span class="line"><span style="color:#24292e;">      　 // 一直循环直到根元素</span></span>
<span class="line"><span style="color:#24292e;">      while(current != null) {　　</span></span>
<span class="line"><span style="color:#24292e;">          left += current.offsetLeft;　　</span></span>
<span class="line"><span style="color:#24292e;">          top += current.offsetTop;　　</span></span>
<span class="line"><span style="color:#24292e;">          current = current.offsetParent;　</span></span>
<span class="line"><span style="color:#24292e;">      }</span></span>
<span class="line"><span style="color:#24292e;">      return {</span></span>
<span class="line"><span style="color:#24292e;">          &quot;left&quot;: left,</span></span>
<span class="line"><span style="color:#24292e;">          &quot;top&quot;: top</span></span>
<span class="line"><span style="color:#24292e;">      };</span></span>
<span class="line"><span style="color:#24292e;">    }</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br></div></div><h3 id="_1-6-元素全屏" tabindex="-1">1.6 元素全屏 <a class="header-anchor" href="#_1-6-元素全屏" aria-label="Permalink to &quot;1.6 元素全屏&quot;">​</a></h3><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">let element = document.getElementById(&quot;embedContainer&quot;);</span></span>
<span class="line"><span style="color:#e1e4e8;">          element.requestFullscreen();</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">let element = document.getElementById(&quot;embedContainer&quot;);</span></span>
<span class="line"><span style="color:#24292e;">          element.requestFullscreen();</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h3 id="dom操作" tabindex="-1">dom操作 <a class="header-anchor" href="#dom操作" aria-label="Permalink to &quot;dom操作&quot;">​</a></h3><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">  2.1 设置文本:</span></span>
<span class="line"><span style="color:#e1e4e8;">   haskell.innerText = &#39;Haskell&#39;; </span></span>
<span class="line"><span style="color:#e1e4e8;">   2.2 设置HTML:</span></span>
<span class="line"><span style="color:#e1e4e8;">   p.innerHTML = &#39;ABC &lt;span style=&quot;color:red&quot;&gt;RED&lt;/span&gt; XYZ&#39;; </span></span>
<span class="line"><span style="color:#e1e4e8;">   2.3 设置css</span></span>
<span class="line"><span style="color:#e1e4e8;">   p.style.color = &#39;#ff0000&#39;;</span></span>
<span class="line"><span style="color:#e1e4e8;">   p.style.fontSize = &#39;20px&#39;; </span></span>
<span class="line"><span style="color:#e1e4e8;">   2.4 设置属性 获取属性 </span></span>
<span class="line"><span style="color:#e1e4e8;">        设置属性 .setAttribute(&quot;属性&quot;,&quot;值&quot;)  </span></span>
<span class="line"><span style="color:#e1e4e8;">        获取属性 .getAttribute(&quot;属性&quot;)</span></span>
<span class="line"><span style="color:#e1e4e8;">   2.5  判断是否包含类</span></span>
<span class="line"><span style="color:#e1e4e8;">   if(main.childNodes[2].classList.contains(&#39;c&#39;)){</span></span>
<span class="line"><span style="color:#e1e4e8;">       console.log(666);</span></span>
<span class="line"><span style="color:#e1e4e8;">   }</span></span>
<span class="line"><span style="color:#e1e4e8;">   2.6 处理类</span></span>
<span class="line"><span style="color:#e1e4e8;">    target.classList.remove(&#39;c&#39;);</span></span>
<span class="line"><span style="color:#e1e4e8;">    obj.className = &#39;new active&#39;; </span></span>
<span class="line"><span style="color:#e1e4e8;">    obj.classList.add(&#39;newActive&#39;);</span></span>
<span class="line"><span style="color:#e1e4e8;">1. 创建节点</span></span>
<span class="line"><span style="color:#e1e4e8;">   3.1 创建元素</span></span>
<span class="line"><span style="color:#e1e4e8;">    var rDiv=document.createElement(&#39;div&#39;);</span></span>
<span class="line"><span style="color:#e1e4e8;">   3.2 最后插入</span></span>
<span class="line"><span style="color:#e1e4e8;">    list.appendChild(haskell);</span></span>
<span class="line"><span style="color:#e1e4e8;">   3.3 指定位置前插入</span></span>
<span class="line"><span style="color:#e1e4e8;">    main.insertBefore(rDiv,main.childNodes[0])</span></span>
<span class="line"><span style="color:#e1e4e8;">4. 删除Dom</span></span>
<span class="line"><span style="color:#e1e4e8;">   4.1 拿到待删除节点:</span></span>
<span class="line"><span style="color:#e1e4e8;">   var self = document.getElementById(&#39;to-be-removed&#39;);</span></span>
<span class="line"><span style="color:#e1e4e8;">   4.2 拿到父节点:</span></span>
<span class="line"><span style="color:#e1e4e8;">   var parent = self.parentElement;</span></span>
<span class="line"><span style="color:#e1e4e8;">   4.3 删除:</span></span>
<span class="line"><span style="color:#e1e4e8;">   var removed = parent.removeChild(self);</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">  2.1 设置文本:</span></span>
<span class="line"><span style="color:#24292e;">   haskell.innerText = &#39;Haskell&#39;; </span></span>
<span class="line"><span style="color:#24292e;">   2.2 设置HTML:</span></span>
<span class="line"><span style="color:#24292e;">   p.innerHTML = &#39;ABC &lt;span style=&quot;color:red&quot;&gt;RED&lt;/span&gt; XYZ&#39;; </span></span>
<span class="line"><span style="color:#24292e;">   2.3 设置css</span></span>
<span class="line"><span style="color:#24292e;">   p.style.color = &#39;#ff0000&#39;;</span></span>
<span class="line"><span style="color:#24292e;">   p.style.fontSize = &#39;20px&#39;; </span></span>
<span class="line"><span style="color:#24292e;">   2.4 设置属性 获取属性 </span></span>
<span class="line"><span style="color:#24292e;">        设置属性 .setAttribute(&quot;属性&quot;,&quot;值&quot;)  </span></span>
<span class="line"><span style="color:#24292e;">        获取属性 .getAttribute(&quot;属性&quot;)</span></span>
<span class="line"><span style="color:#24292e;">   2.5  判断是否包含类</span></span>
<span class="line"><span style="color:#24292e;">   if(main.childNodes[2].classList.contains(&#39;c&#39;)){</span></span>
<span class="line"><span style="color:#24292e;">       console.log(666);</span></span>
<span class="line"><span style="color:#24292e;">   }</span></span>
<span class="line"><span style="color:#24292e;">   2.6 处理类</span></span>
<span class="line"><span style="color:#24292e;">    target.classList.remove(&#39;c&#39;);</span></span>
<span class="line"><span style="color:#24292e;">    obj.className = &#39;new active&#39;; </span></span>
<span class="line"><span style="color:#24292e;">    obj.classList.add(&#39;newActive&#39;);</span></span>
<span class="line"><span style="color:#24292e;">1. 创建节点</span></span>
<span class="line"><span style="color:#24292e;">   3.1 创建元素</span></span>
<span class="line"><span style="color:#24292e;">    var rDiv=document.createElement(&#39;div&#39;);</span></span>
<span class="line"><span style="color:#24292e;">   3.2 最后插入</span></span>
<span class="line"><span style="color:#24292e;">    list.appendChild(haskell);</span></span>
<span class="line"><span style="color:#24292e;">   3.3 指定位置前插入</span></span>
<span class="line"><span style="color:#24292e;">    main.insertBefore(rDiv,main.childNodes[0])</span></span>
<span class="line"><span style="color:#24292e;">4. 删除Dom</span></span>
<span class="line"><span style="color:#24292e;">   4.1 拿到待删除节点:</span></span>
<span class="line"><span style="color:#24292e;">   var self = document.getElementById(&#39;to-be-removed&#39;);</span></span>
<span class="line"><span style="color:#24292e;">   4.2 拿到父节点:</span></span>
<span class="line"><span style="color:#24292e;">   var parent = self.parentElement;</span></span>
<span class="line"><span style="color:#24292e;">   4.3 删除:</span></span>
<span class="line"><span style="color:#24292e;">   var removed = parent.removeChild(self);</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br></div></div><h3 id="mouseover-与mouseenter" tabindex="-1">mouseover 与mouseenter <a class="header-anchor" href="#mouseover-与mouseenter" aria-label="Permalink to &quot;mouseover 与mouseenter&quot;">​</a></h3><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">mouseover: 只要鼠标指针移入事件所绑定的元素或其子元素，都会触发该事件 对应mouseout</span></span>
<span class="line"><span style="color:#e1e4e8;">mouseenter: 只有鼠标指针移入事件所绑定的元素时，才会触发该事件 对应mouseleave</span></span>
<span class="line"><span style="color:#e1e4e8;">mouseout: 只要鼠标指针移出事件所绑定的元素或其子元素，都会触发该事件</span></span>
<span class="line"><span style="color:#e1e4e8;">mouseleave: 只有鼠标指针移出事件所绑定的元素时，才会触发该事件</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">mouseover: 只要鼠标指针移入事件所绑定的元素或其子元素，都会触发该事件 对应mouseout</span></span>
<span class="line"><span style="color:#24292e;">mouseenter: 只有鼠标指针移入事件所绑定的元素时，才会触发该事件 对应mouseleave</span></span>
<span class="line"><span style="color:#24292e;">mouseout: 只要鼠标指针移出事件所绑定的元素或其子元素，都会触发该事件</span></span>
<span class="line"><span style="color:#24292e;">mouseleave: 只有鼠标指针移出事件所绑定的元素时，才会触发该事件</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><h2 id="设置style属性" tabindex="-1">设置style属性 <a class="header-anchor" href="#设置style属性" aria-label="Permalink to &quot;设置style属性&quot;">​</a></h2><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">box.style.height=300+&#39;px&#39;;</span></span>
<span class="line"><span style="color:#e1e4e8;">box.setAttribute(&#39;style&#39;,&#39;background-color:red;height:400px&#39;)</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">box.style.height=300+&#39;px&#39;;</span></span>
<span class="line"><span style="color:#24292e;">box.setAttribute(&#39;style&#39;,&#39;background-color:red;height:400px&#39;)</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h1 id="四、常用方法" tabindex="-1">四、常用方法 <a class="header-anchor" href="#四、常用方法" aria-label="Permalink to &quot;四、常用方法&quot;">​</a></h1><div class="language-javascript vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">javascript</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">    window.onload</span><span style="color:#F97583;">=</span><span style="color:#B392F0;">movexxx</span><span style="color:#E1E4E8;">();</span><span style="color:#6A737D;">//页面载入即加载</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#6A737D;">//定时执行</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">movexxx</span><span style="color:#E1E4E8;">(){</span></span>
<span class="line"><span style="color:#E1E4E8;">		alert（</span><span style="color:#79B8FF;">23</span><span style="color:#E1E4E8;">）；</span></span>
<span class="line"><span style="color:#E1E4E8;">	   </span><span style="color:#B392F0;">setTimeout</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;movsss()&quot;</span><span style="color:#E1E4E8;">,</span><span style="color:#79B8FF;">2000</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">	};</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#6A737D;">//循环执行 模拟点击</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#B392F0;">setInterval</span><span style="color:#E1E4E8;">(</span><span style="color:#F97583;">function</span><span style="color:#E1E4E8;">(){</span></span>
<span class="line"><span style="color:#E1E4E8;">		document.</span><span style="color:#B392F0;">getElementById</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;pppp&#39;</span><span style="color:#E1E4E8;">).</span><span style="color:#B392F0;">click</span><span style="color:#E1E4E8;">();</span></span>
<span class="line"><span style="color:#E1E4E8;">	},</span><span style="color:#79B8FF;">2000</span><span style="color:#E1E4E8;">)</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#6A737D;">//全返</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">checkall</span><span style="color:#E1E4E8;">(){</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">var</span><span style="color:#E1E4E8;"> e </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;">document.form1;</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">for</span><span style="color:#E1E4E8;"> (</span><span style="color:#F97583;">var</span><span style="color:#E1E4E8;"> i</span><span style="color:#F97583;">=</span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">;i</span><span style="color:#F97583;">&lt;</span><span style="color:#E1E4E8;"> e.elements.</span><span style="color:#79B8FF;">length</span><span style="color:#E1E4E8;">;i</span><span style="color:#F97583;">++</span><span style="color:#E1E4E8;">){</span></span>
<span class="line"><span style="color:#E1E4E8;">			</span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">(</span><span style="color:#F97583;">!</span><span style="color:#E1E4E8;">e.elements[i].checked){</span></span>
<span class="line"><span style="color:#E1E4E8;">				e.elements[i].checked</span><span style="color:#F97583;">=</span><span style="color:#79B8FF;">true</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">			}</span></span>
<span class="line"><span style="color:#E1E4E8;">		}</span></span>
<span class="line"><span style="color:#E1E4E8;">	}</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#6A737D;">//多重数据提交</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">showlist</span><span style="color:#E1E4E8;">(){</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">var</span><span style="color:#E1E4E8;"> e </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;">document.form1;</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">var</span><span style="color:#E1E4E8;"> list </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;&#39;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">for</span><span style="color:#E1E4E8;"> (</span><span style="color:#F97583;">var</span><span style="color:#E1E4E8;"> i</span><span style="color:#F97583;">=</span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">;i</span><span style="color:#F97583;">&lt;</span><span style="color:#E1E4E8;"> e.elements.</span><span style="color:#79B8FF;">length</span><span style="color:#E1E4E8;">;i</span><span style="color:#F97583;">++</span><span style="color:#E1E4E8;">){</span></span>
<span class="line"><span style="color:#E1E4E8;">			</span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">(e.elements[i].checked</span><span style="color:#F97583;">&amp;&amp;</span><span style="color:#E1E4E8;">e.elements[i].type</span><span style="color:#F97583;">==</span><span style="color:#9ECBFF;">&#39;checkbox&#39;</span><span style="color:#E1E4E8;">){</span></span>
<span class="line"><span style="color:#E1E4E8;">				list</span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;">list</span><span style="color:#F97583;">+</span><span style="color:#E1E4E8;">e.elements[i].value</span><span style="color:#F97583;">+</span><span style="color:#9ECBFF;">&#39;||&#39;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">			}</span></span>
<span class="line"><span style="color:#E1E4E8;">		}</span></span>
<span class="line"><span style="color:#E1E4E8;">		e.peoples.value</span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;">list;</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span></span>
<span class="line"><span style="color:#E1E4E8;">	}</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#6A737D;">//反选</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">check</span><span style="color:#E1E4E8;">(){</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">var</span><span style="color:#E1E4E8;"> e </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;">document.form1;</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">for</span><span style="color:#E1E4E8;"> (</span><span style="color:#F97583;">var</span><span style="color:#E1E4E8;"> i</span><span style="color:#F97583;">=</span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">;i</span><span style="color:#F97583;">&lt;</span><span style="color:#E1E4E8;"> e.elements.</span><span style="color:#79B8FF;">length</span><span style="color:#E1E4E8;">;i</span><span style="color:#F97583;">++</span><span style="color:#E1E4E8;">){</span></span>
<span class="line"><span style="color:#E1E4E8;">			</span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">(</span><span style="color:#F97583;">!</span><span style="color:#E1E4E8;">e.elements[i].checked){</span></span>
<span class="line"><span style="color:#E1E4E8;">				e.elements[i].checked</span><span style="color:#F97583;">=</span><span style="color:#79B8FF;">true</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">			}</span><span style="color:#F97583;">else</span><span style="color:#E1E4E8;">{</span></span>
<span class="line"><span style="color:#E1E4E8;">				e.elements[i].checked</span><span style="color:#F97583;">=</span><span style="color:#79B8FF;">false</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">			}</span></span>
<span class="line"><span style="color:#E1E4E8;">		}</span></span>
<span class="line"><span style="color:#E1E4E8;">	}</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#6A737D;">//是否确定关闭</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">closewindow</span><span style="color:#E1E4E8;">(){</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">var</span><span style="color:#E1E4E8;"> clo</span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;">window.</span><span style="color:#B392F0;">confirm</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;真的要关闭窗口吗&#39;</span><span style="color:#E1E4E8;">);</span><span style="color:#6A737D;">//确定关闭</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">(clo){</span></span>
<span class="line"><span style="color:#E1E4E8;">			window.</span><span style="color:#B392F0;">close</span><span style="color:#E1E4E8;">();</span><span style="color:#6A737D;">//关闭窗口</span></span>
<span class="line"><span style="color:#E1E4E8;">		}</span></span>
<span class="line"><span style="color:#E1E4E8;">	}</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">    window.onload</span><span style="color:#D73A49;">=</span><span style="color:#6F42C1;">movexxx</span><span style="color:#24292E;">();</span><span style="color:#6A737D;">//页面载入即加载</span></span>
<span class="line"><span style="color:#24292E;">	</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#6A737D;">//定时执行</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">movexxx</span><span style="color:#24292E;">(){</span></span>
<span class="line"><span style="color:#24292E;">		alert（</span><span style="color:#005CC5;">23</span><span style="color:#24292E;">）；</span></span>
<span class="line"><span style="color:#24292E;">	   </span><span style="color:#6F42C1;">setTimeout</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;movsss()&quot;</span><span style="color:#24292E;">,</span><span style="color:#005CC5;">2000</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">	};</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#6A737D;">//循环执行 模拟点击</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#6F42C1;">setInterval</span><span style="color:#24292E;">(</span><span style="color:#D73A49;">function</span><span style="color:#24292E;">(){</span></span>
<span class="line"><span style="color:#24292E;">		document.</span><span style="color:#6F42C1;">getElementById</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;pppp&#39;</span><span style="color:#24292E;">).</span><span style="color:#6F42C1;">click</span><span style="color:#24292E;">();</span></span>
<span class="line"><span style="color:#24292E;">	},</span><span style="color:#005CC5;">2000</span><span style="color:#24292E;">)</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#6A737D;">//全返</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">checkall</span><span style="color:#24292E;">(){</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">var</span><span style="color:#24292E;"> e </span><span style="color:#D73A49;">=</span><span style="color:#24292E;">document.form1;</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">for</span><span style="color:#24292E;"> (</span><span style="color:#D73A49;">var</span><span style="color:#24292E;"> i</span><span style="color:#D73A49;">=</span><span style="color:#005CC5;">0</span><span style="color:#24292E;">;i</span><span style="color:#D73A49;">&lt;</span><span style="color:#24292E;"> e.elements.</span><span style="color:#005CC5;">length</span><span style="color:#24292E;">;i</span><span style="color:#D73A49;">++</span><span style="color:#24292E;">){</span></span>
<span class="line"><span style="color:#24292E;">			</span><span style="color:#D73A49;">if</span><span style="color:#24292E;">(</span><span style="color:#D73A49;">!</span><span style="color:#24292E;">e.elements[i].checked){</span></span>
<span class="line"><span style="color:#24292E;">				e.elements[i].checked</span><span style="color:#D73A49;">=</span><span style="color:#005CC5;">true</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">			}</span></span>
<span class="line"><span style="color:#24292E;">		}</span></span>
<span class="line"><span style="color:#24292E;">	}</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#6A737D;">//多重数据提交</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">showlist</span><span style="color:#24292E;">(){</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">var</span><span style="color:#24292E;"> e </span><span style="color:#D73A49;">=</span><span style="color:#24292E;">document.form1;</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">var</span><span style="color:#24292E;"> list </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;&#39;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">for</span><span style="color:#24292E;"> (</span><span style="color:#D73A49;">var</span><span style="color:#24292E;"> i</span><span style="color:#D73A49;">=</span><span style="color:#005CC5;">0</span><span style="color:#24292E;">;i</span><span style="color:#D73A49;">&lt;</span><span style="color:#24292E;"> e.elements.</span><span style="color:#005CC5;">length</span><span style="color:#24292E;">;i</span><span style="color:#D73A49;">++</span><span style="color:#24292E;">){</span></span>
<span class="line"><span style="color:#24292E;">			</span><span style="color:#D73A49;">if</span><span style="color:#24292E;">(e.elements[i].checked</span><span style="color:#D73A49;">&amp;&amp;</span><span style="color:#24292E;">e.elements[i].type</span><span style="color:#D73A49;">==</span><span style="color:#032F62;">&#39;checkbox&#39;</span><span style="color:#24292E;">){</span></span>
<span class="line"><span style="color:#24292E;">				list</span><span style="color:#D73A49;">=</span><span style="color:#24292E;">list</span><span style="color:#D73A49;">+</span><span style="color:#24292E;">e.elements[i].value</span><span style="color:#D73A49;">+</span><span style="color:#032F62;">&#39;||&#39;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">			}</span></span>
<span class="line"><span style="color:#24292E;">		}</span></span>
<span class="line"><span style="color:#24292E;">		e.peoples.value</span><span style="color:#D73A49;">=</span><span style="color:#24292E;">list;</span></span>
<span class="line"><span style="color:#24292E;">		</span></span>
<span class="line"><span style="color:#24292E;">	}</span></span>
<span class="line"><span style="color:#24292E;">	</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#6A737D;">//反选</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">check</span><span style="color:#24292E;">(){</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">var</span><span style="color:#24292E;"> e </span><span style="color:#D73A49;">=</span><span style="color:#24292E;">document.form1;</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">for</span><span style="color:#24292E;"> (</span><span style="color:#D73A49;">var</span><span style="color:#24292E;"> i</span><span style="color:#D73A49;">=</span><span style="color:#005CC5;">0</span><span style="color:#24292E;">;i</span><span style="color:#D73A49;">&lt;</span><span style="color:#24292E;"> e.elements.</span><span style="color:#005CC5;">length</span><span style="color:#24292E;">;i</span><span style="color:#D73A49;">++</span><span style="color:#24292E;">){</span></span>
<span class="line"><span style="color:#24292E;">			</span><span style="color:#D73A49;">if</span><span style="color:#24292E;">(</span><span style="color:#D73A49;">!</span><span style="color:#24292E;">e.elements[i].checked){</span></span>
<span class="line"><span style="color:#24292E;">				e.elements[i].checked</span><span style="color:#D73A49;">=</span><span style="color:#005CC5;">true</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">			}</span><span style="color:#D73A49;">else</span><span style="color:#24292E;">{</span></span>
<span class="line"><span style="color:#24292E;">				e.elements[i].checked</span><span style="color:#D73A49;">=</span><span style="color:#005CC5;">false</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">			}</span></span>
<span class="line"><span style="color:#24292E;">		}</span></span>
<span class="line"><span style="color:#24292E;">	}</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#6A737D;">//是否确定关闭</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">closewindow</span><span style="color:#24292E;">(){</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">var</span><span style="color:#24292E;"> clo</span><span style="color:#D73A49;">=</span><span style="color:#24292E;">window.</span><span style="color:#6F42C1;">confirm</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;真的要关闭窗口吗&#39;</span><span style="color:#24292E;">);</span><span style="color:#6A737D;">//确定关闭</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">if</span><span style="color:#24292E;">(clo){</span></span>
<span class="line"><span style="color:#24292E;">			window.</span><span style="color:#6F42C1;">close</span><span style="color:#24292E;">();</span><span style="color:#6A737D;">//关闭窗口</span></span>
<span class="line"><span style="color:#24292E;">		}</span></span>
<span class="line"><span style="color:#24292E;">	}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br><span class="line-number">47</span><br><span class="line-number">48</span><br><span class="line-number">49</span><br><span class="line-number">50</span><br><span class="line-number">51</span><br></div></div><h3 id="异步请求上传文件" tabindex="-1">异步请求上传文件 <a class="header-anchor" href="#异步请求上传文件" aria-label="Permalink to &quot;异步请求上传文件&quot;">​</a></h3><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;"> const formData = new FormData(); // new一个formData事件</span></span>
<span class="line"><span style="color:#e1e4e8;"> formData.append(&quot;file&quot;, file); //</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;"> const formData = new FormData(); // new一个formData事件</span></span>
<span class="line"><span style="color:#24292e;"> formData.append(&quot;file&quot;, file); //</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h3 id="下载文件并重新命名" tabindex="-1">下载文件并重新命名 <a class="header-anchor" href="#下载文件并重新命名" aria-label="Permalink to &quot;下载文件并重新命名&quot;">​</a></h3><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">  downloadFile(url, fileName) {</span></span>
<span class="line"><span style="color:#e1e4e8;">      const x = new XMLHttpRequest();</span></span>
<span class="line"><span style="color:#e1e4e8;">      x.open(&quot;GET&quot;, url, true);</span></span>
<span class="line"><span style="color:#e1e4e8;">      x.responseType = &quot;blob&quot;;</span></span>
<span class="line"><span style="color:#e1e4e8;">      x.onload = function (e) {</span></span>
<span class="line"><span style="color:#e1e4e8;">        //会创建一个 DOMString，其中包含一个表示参数中给出的对象的URL。这个 URL 的生命周期和创建它的窗口中的 document 绑定。这个新的URL 对象表示指定的 File 对象或 Blob 对象。</span></span>
<span class="line"><span style="color:#e1e4e8;">        let urls = window.URL.createObjectURL(x.response);</span></span>
<span class="line"><span style="color:#e1e4e8;">        let a = document.createElement(&quot;a&quot;);</span></span>
<span class="line"><span style="color:#e1e4e8;">        a.href = urls;</span></span>
<span class="line"><span style="color:#e1e4e8;">        a.download = fileName;</span></span>
<span class="line"><span style="color:#e1e4e8;">        a.click();</span></span>
<span class="line"><span style="color:#e1e4e8;">      };</span></span>
<span class="line"><span style="color:#e1e4e8;">      x.send();</span></span>
<span class="line"><span style="color:#e1e4e8;">    },</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">  downloadFile(url, fileName) {</span></span>
<span class="line"><span style="color:#24292e;">      const x = new XMLHttpRequest();</span></span>
<span class="line"><span style="color:#24292e;">      x.open(&quot;GET&quot;, url, true);</span></span>
<span class="line"><span style="color:#24292e;">      x.responseType = &quot;blob&quot;;</span></span>
<span class="line"><span style="color:#24292e;">      x.onload = function (e) {</span></span>
<span class="line"><span style="color:#24292e;">        //会创建一个 DOMString，其中包含一个表示参数中给出的对象的URL。这个 URL 的生命周期和创建它的窗口中的 document 绑定。这个新的URL 对象表示指定的 File 对象或 Blob 对象。</span></span>
<span class="line"><span style="color:#24292e;">        let urls = window.URL.createObjectURL(x.response);</span></span>
<span class="line"><span style="color:#24292e;">        let a = document.createElement(&quot;a&quot;);</span></span>
<span class="line"><span style="color:#24292e;">        a.href = urls;</span></span>
<span class="line"><span style="color:#24292e;">        a.download = fileName;</span></span>
<span class="line"><span style="color:#24292e;">        a.click();</span></span>
<span class="line"><span style="color:#24292e;">      };</span></span>
<span class="line"><span style="color:#24292e;">      x.send();</span></span>
<span class="line"><span style="color:#24292e;">    },</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br></div></div><h3 id="节流防抖" tabindex="-1">节流防抖 <a class="header-anchor" href="#节流防抖" aria-label="Permalink to &quot;节流防抖&quot;">​</a></h3><blockquote><ul><li><strong>防抖</strong>是触发间隔大于timer才会触发，所以每次在小于间隔time要清除定时器 保证触发一次 目的在于获取最后的结果</li><li><strong>节流</strong>是不管time内触发多少次，只会每间隔time时间才会触发一次，会触发多次，目的在于获取过程</li></ul></blockquote><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">//防抖</span></span>
<span class="line"><span style="color:#e1e4e8;">debounce(fn, delay) {</span></span>
<span class="line"><span style="color:#e1e4e8;">      let timer = null; //借助闭包</span></span>
<span class="line"><span style="color:#e1e4e8;">      return function () {</span></span>
<span class="line"><span style="color:#e1e4e8;">        if (timer) {</span></span>
<span class="line"><span style="color:#e1e4e8;">          clearTimeout(timer);</span></span>
<span class="line"><span style="color:#e1e4e8;">        }</span></span>
<span class="line"><span style="color:#e1e4e8;">        timer = setTimeout(fn, delay); // 简化写法</span></span>
<span class="line"><span style="color:#e1e4e8;">      };</span></span>
<span class="line"><span style="color:#e1e4e8;">    },</span></span>
<span class="line"><span style="color:#e1e4e8;">this.$refs.box.addEventListener(&quot;scroll&quot;, this.debounce(this.handleScroll, 500));</span></span>
<span class="line"><span style="color:#e1e4e8;"></span></span>
<span class="line"><span style="color:#e1e4e8;">//节流</span></span>
<span class="line"><span style="color:#e1e4e8;">function throttle(fn,delay=200){</span></span>
<span class="line"><span style="color:#e1e4e8;">		let timer = null;</span></span>
<span class="line"><span style="color:#e1e4e8;">		return function(){</span></span>
<span class="line"><span style="color:#e1e4e8;">			if(timer) return;</span></span>
<span class="line"><span style="color:#e1e4e8;">			timer = setTimeout(()=&gt;{</span></span>
<span class="line"><span style="color:#e1e4e8;">				fn.apply(this.arguments);</span></span>
<span class="line"><span style="color:#e1e4e8;">			},delay);</span></span>
<span class="line"><span style="color:#e1e4e8;">		}</span></span>
<span class="line"><span style="color:#e1e4e8;">	}</span></span>
<span class="line"><span style="color:#e1e4e8;">	dom1.addEventListener(&#39;drag&#39;,throttle((e)=&gt;{</span></span>
<span class="line"><span style="color:#e1e4e8;">		console.log(e.offsetX,e.offsetY);</span></span>
<span class="line"><span style="color:#e1e4e8;">	}),200)</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">//防抖</span></span>
<span class="line"><span style="color:#24292e;">debounce(fn, delay) {</span></span>
<span class="line"><span style="color:#24292e;">      let timer = null; //借助闭包</span></span>
<span class="line"><span style="color:#24292e;">      return function () {</span></span>
<span class="line"><span style="color:#24292e;">        if (timer) {</span></span>
<span class="line"><span style="color:#24292e;">          clearTimeout(timer);</span></span>
<span class="line"><span style="color:#24292e;">        }</span></span>
<span class="line"><span style="color:#24292e;">        timer = setTimeout(fn, delay); // 简化写法</span></span>
<span class="line"><span style="color:#24292e;">      };</span></span>
<span class="line"><span style="color:#24292e;">    },</span></span>
<span class="line"><span style="color:#24292e;">this.$refs.box.addEventListener(&quot;scroll&quot;, this.debounce(this.handleScroll, 500));</span></span>
<span class="line"><span style="color:#24292e;"></span></span>
<span class="line"><span style="color:#24292e;">//节流</span></span>
<span class="line"><span style="color:#24292e;">function throttle(fn,delay=200){</span></span>
<span class="line"><span style="color:#24292e;">		let timer = null;</span></span>
<span class="line"><span style="color:#24292e;">		return function(){</span></span>
<span class="line"><span style="color:#24292e;">			if(timer) return;</span></span>
<span class="line"><span style="color:#24292e;">			timer = setTimeout(()=&gt;{</span></span>
<span class="line"><span style="color:#24292e;">				fn.apply(this.arguments);</span></span>
<span class="line"><span style="color:#24292e;">			},delay);</span></span>
<span class="line"><span style="color:#24292e;">		}</span></span>
<span class="line"><span style="color:#24292e;">	}</span></span>
<span class="line"><span style="color:#24292e;">	dom1.addEventListener(&#39;drag&#39;,throttle((e)=&gt;{</span></span>
<span class="line"><span style="color:#24292e;">		console.log(e.offsetX,e.offsetY);</span></span>
<span class="line"><span style="color:#24292e;">	}),200)</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br></div></div><h3 id="深拷贝" tabindex="-1">深拷贝 <a class="header-anchor" href="#深拷贝" aria-label="Permalink to &quot;深拷贝&quot;">​</a></h3><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">function deepCopy(target, cache = new Set()) {</span></span>
<span class="line"><span style="color:#e1e4e8;">// 注意环引用</span></span>
<span class="line"><span style="color:#e1e4e8;">  if (</span></span>
<span class="line"><span style="color:#e1e4e8;">    (typeof target !== &#39;object&#39; &amp;&amp; target !== null) ||</span></span>
<span class="line"><span style="color:#e1e4e8;">      cache.has(target)</span></span>
<span class="line"><span style="color:#e1e4e8;">    ) {</span></span>
<span class="line"><span style="color:#e1e4e8;">    return target</span></span>
<span class="line"><span style="color:#e1e4e8;">  }</span></span>
<span class="line"><span style="color:#e1e4e8;">  if (Array.isArray(target)) {</span></span>
<span class="line"><span style="color:#e1e4e8;">    return target.map(t =&gt; {</span></span>
<span class="line"><span style="color:#e1e4e8;">      cache.add(t)</span></span>
<span class="line"><span style="color:#e1e4e8;">      return t</span></span>
<span class="line"><span style="color:#e1e4e8;">    })</span></span>
<span class="line"><span style="color:#e1e4e8;">  } else {</span></span>
<span class="line"><span style="color:#e1e4e8;">// 注意symbol key</span></span>
<span class="line"><span style="color:#e1e4e8;">    return [...Object.keys(target), ...Object.getOwnPropertySymbols(target)].reduce((res, key) =&gt; {</span></span>
<span class="line"><span style="color:#e1e4e8;">      cache.add(target[key])</span></span>
<span class="line"><span style="color:#e1e4e8;">      res[key] = deepCopy(target[key], cache)</span></span>
<span class="line"><span style="color:#e1e4e8;">      return res</span></span>
<span class="line"><span style="color:#e1e4e8;">    }, target.constructor !== Object ? Object.create(target.constructor.prototype) : {}) // 继承</span></span>
<span class="line"><span style="color:#e1e4e8;">  }</span></span>
<span class="line"><span style="color:#e1e4e8;">}</span></span>
<span class="line"><span style="color:#e1e4e8;">复制代码</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">function deepCopy(target, cache = new Set()) {</span></span>
<span class="line"><span style="color:#24292e;">// 注意环引用</span></span>
<span class="line"><span style="color:#24292e;">  if (</span></span>
<span class="line"><span style="color:#24292e;">    (typeof target !== &#39;object&#39; &amp;&amp; target !== null) ||</span></span>
<span class="line"><span style="color:#24292e;">      cache.has(target)</span></span>
<span class="line"><span style="color:#24292e;">    ) {</span></span>
<span class="line"><span style="color:#24292e;">    return target</span></span>
<span class="line"><span style="color:#24292e;">  }</span></span>
<span class="line"><span style="color:#24292e;">  if (Array.isArray(target)) {</span></span>
<span class="line"><span style="color:#24292e;">    return target.map(t =&gt; {</span></span>
<span class="line"><span style="color:#24292e;">      cache.add(t)</span></span>
<span class="line"><span style="color:#24292e;">      return t</span></span>
<span class="line"><span style="color:#24292e;">    })</span></span>
<span class="line"><span style="color:#24292e;">  } else {</span></span>
<span class="line"><span style="color:#24292e;">// 注意symbol key</span></span>
<span class="line"><span style="color:#24292e;">    return [...Object.keys(target), ...Object.getOwnPropertySymbols(target)].reduce((res, key) =&gt; {</span></span>
<span class="line"><span style="color:#24292e;">      cache.add(target[key])</span></span>
<span class="line"><span style="color:#24292e;">      res[key] = deepCopy(target[key], cache)</span></span>
<span class="line"><span style="color:#24292e;">      return res</span></span>
<span class="line"><span style="color:#24292e;">    }, target.constructor !== Object ? Object.create(target.constructor.prototype) : {}) // 继承</span></span>
<span class="line"><span style="color:#24292e;">  }</span></span>
<span class="line"><span style="color:#24292e;">}</span></span>
<span class="line"><span style="color:#24292e;">复制代码</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br></div></div><h1 id="五、es6新语法" tabindex="-1">五、<a id="op5">es6新语法</a> <a class="header-anchor" href="#五、es6新语法" aria-label="Permalink to &quot;五、&lt;a id=&quot;op5&quot;&gt;es6新语法&lt;/a&gt;&quot;">​</a></h1><h2 id="_5-1-字符拼接" tabindex="-1">5.1 字符拼接 <a class="header-anchor" href="#_5-1-字符拼接" aria-label="Permalink to &quot;5.1 字符拼接&quot;">​</a></h2><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">var name=&#39;ming&#39;;</span></span>
<span class="line"><span style="color:#e1e4e8;">var age=20;`</span></span>
<span class="line"><span style="color:#e1e4e8;">var message=`hello,${name1},your age is ${age1}`;      //`是主键盘数字1左边的符号</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">var name=&#39;ming&#39;;</span></span>
<span class="line"><span style="color:#24292e;">var age=20;`</span></span>
<span class="line"><span style="color:#24292e;">var message=`hello,${name1},your age is ${age1}`;      //`是主键盘数字1左边的符号</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><h2 id="数组操作" tabindex="-1">数组操作 <a class="header-anchor" href="#数组操作" aria-label="Permalink to &quot;数组操作&quot;">​</a></h2><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">let arr = [‘apple&#39;,&#39;pear&#39;,&#39;banana&#39;,&#39;orange&#39;,&#39;pink&#39;];</span></span>
<span class="line"><span style="color:#e1e4e8;">arr.push(&#39;apple&#39;);//末位添加</span></span>
<span class="line"><span style="color:#e1e4e8;">arr.splice(&#39;apple&#39;);//原对象修改 删除或添加</span></span>
<span class="line"><span style="color:#e1e4e8;">let arr1 = arr.slice(0,2);//截取0，到第3位</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">let arr = [‘apple&#39;,&#39;pear&#39;,&#39;banana&#39;,&#39;orange&#39;,&#39;pink&#39;];</span></span>
<span class="line"><span style="color:#24292e;">arr.push(&#39;apple&#39;);//末位添加</span></span>
<span class="line"><span style="color:#24292e;">arr.splice(&#39;apple&#39;);//原对象修改 删除或添加</span></span>
<span class="line"><span style="color:#24292e;">let arr1 = arr.slice(0,2);//截取0，到第3位</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><h3 id="获取-判断对象中包含值" tabindex="-1">获取 判断对象中包含值 <a class="header-anchor" href="#获取-判断对象中包含值" aria-label="Permalink to &quot;获取 判断对象中包含值&quot;">​</a></h3><p><code>map every some find filter </code></p><h3 id="获取索引" tabindex="-1">获取索引 <a class="header-anchor" href="#获取索引" aria-label="Permalink to &quot;获取索引&quot;">​</a></h3><p><code>indexOf findindexOf lastindexOf</code></p><h3 id="排序" tabindex="-1">排序 <a class="header-anchor" href="#排序" aria-label="Permalink to &quot;排序&quot;">​</a></h3><p><code>sort</code></p><h3 id="计算" tabindex="-1">计算 <a class="header-anchor" href="#计算" aria-label="Permalink to &quot;计算&quot;">​</a></h3><p>reduce</p><h1 id="六、事件处理" tabindex="-1">六、事件处理 <a class="header-anchor" href="#六、事件处理" aria-label="Permalink to &quot;六、事件处理&quot;">​</a></h1><p>阻止冒泡：e.preventDefault();</p><h1 id="七、-存储方法" tabindex="-1">七、 存储方法 <a class="header-anchor" href="#七、-存储方法" aria-label="Permalink to &quot;七、 存储方法&quot;">​</a></h1><h2 id="sessionstorage" tabindex="-1">sessionStorage <a class="header-anchor" href="#sessionstorage" aria-label="Permalink to &quot;sessionStorage&quot;">​</a></h2><blockquote><p>保存数据语法：</p></blockquote><p>sessionStorage.setItem(&quot;key&quot;, &quot;value&quot;);</p><blockquote><p>读取数据语法：</p></blockquote><p>var lastname = sessionStorage.getItem(&quot;key&quot;);</p><blockquote><p>删除指定键的数据语法：</p></blockquote><p>sessionStorage.removeItem(&quot;key&quot;);</p><blockquote><p>删除所有数据：</p></blockquote><p>sessionStorage.clear();</p><h2 id="localstorage" tabindex="-1">localStorage <a class="header-anchor" href="#localstorage" aria-label="Permalink to &quot;localStorage&quot;">​</a></h2><blockquote><p>方法同 sessionStorage</p></blockquote><h1 id="八、-js库" tabindex="-1">八、 js库 <a class="header-anchor" href="#八、-js库" aria-label="Permalink to &quot;八、 js库&quot;">​</a></h1><h2 id="lodash" tabindex="-1">lodash <a class="header-anchor" href="#lodash" aria-label="Permalink to &quot;lodash&quot;">​</a></h2><p>Lodash 是一个一致性、模块化、高性能的 JavaScript 实用工具库。</p><p>Lodash 遵循 MIT 开源协议发布，并且支持最新的运行环境。 查看各个构件版本的区别并选择一个适合你的版本。</p><p><a href="https://www.lodashjs.com/" target="_blank" rel="noreferrer">Lodash 简介 | Lodash 中文文档 | Lodash 中文网 (lodashjs.com)</a></p></div></div></main><footer class="VPDocFooter" data-v-6b87e69f data-v-ef5dee53><!--[--><!--]--><!----><nav class="prev-next" data-v-ef5dee53><div class="pager" data-v-ef5dee53><a class="pager-link prev" href="/tools/git%E7%AC%94%E8%AE%B0.html" data-v-ef5dee53><span class="desc" data-v-ef5dee53>Previous page</span><span class="title" data-v-ef5dee53>git笔记</span></a></div><div class="pager" data-v-ef5dee53><a class="pager-link next" href="/tools/linux%E5%91%BD%E4%BB%A4.html" data-v-ef5dee53><span class="desc" data-v-ef5dee53>Next page</span><span class="title" data-v-ef5dee53>linux命令</span></a></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!--]--></div></div>
    <script>window.__VP_HASH_MAP__=JSON.parse("{\"case_getaccesstoken.md\":\"67a16083\",\"case_前端日志.md\":\"270996e6\",\"case_前端防切屏.md\":\"6d67367b\",\"ai学习笔记_个人理解.md\":\"62e8b40f\",\"case_vue实例技巧.md\":\"75787181\",\"日志_关于企业站的seo.md\":\"496419f4\",\"case_插件使用配置.md\":\"fe83b1c1\",\"办公_版本处理方案.md\":\"e749eb0e\",\"办公_开发记录.md\":\"437c4662\",\"case_mac使用.md\":\"48c33f34\",\"办公_app开通微信支付.md\":\"95c825d6\",\"tools_arduino基础操作.md\":\"f997fb69\",\"日志_uniapp内存泄漏事件.md\":\"25a76630\",\"case_ios上架笔记.md\":\"84d52929\",\"case_开发富文本本编辑器.md\":\"d7842807\",\"办公_ebm后端及数据库笔记.md\":\"0c19b5f3\",\"case_uniapp踩坑记录.md\":\"4e47ad2a\",\"tools_conda命令  pip命令.md\":\"23ac8380\",\"办公_待解决问题.md\":\"dcc132f1\",\"case_优秀的开源vue组件.md\":\"6020f82e\",\"case_样式布局.md\":\"670153be\",\"tools_emmet web快速构建命令.md\":\"02ded381\",\"ai学习笔记_二、应用场景.md\":\"3985787b\",\"java笔记_程序基础.md\":\"750d7bf5\",\"日志_合格的文档.md\":\"e2dd10c4\",\"tools_index.md\":\"8efae136\",\"tools_设计规范.md\":\"c1e5222d\",\"case_转pdf相关.md\":\"9b047234\",\"case_vuex使用示例.md\":\"042f3339\",\"tools_elementui笔记.md\":\"d727814f\",\"办公_应用中心框架更新.md\":\"9124a7e9\",\"ai学习笔记_一、概念.md\":\"960b8e6d\",\"case_markdown文件转换目录列表.md\":\"f04a5805\",\"tools_cmd npm yarn pnpm命令.md\":\"deebc540\",\"case_css技巧.md\":\"cedd6cee\",\"ai学习笔记_四、模型.md\":\"f9d2ec81\",\"办公_代码示例_l律所起诉状.md\":\"f875bace\",\"tools_adb命令.md\":\"9831c553\",\"tools_命名汇总推荐.md\":\"3bf819e1\",\"办公_seo方案.md\":\"22a7e45f\",\"java笔记_面向对象编程.md\":\"486db2ad\",\"日志_测试笔记.md\":\"00dcc692\",\"case_python自动测试脚本.md\":\"bec8212a\",\"index.md\":\"25642d62\",\"tools_mac使用笔记.md\":\"9ee5b2a6\",\"办公_实施笔记.md\":\"10ecc800\",\"tools_vue笔记.md\":\"be570cd4\",\"ai学习笔记_五、模型发展.md\":\"a9feb551\",\"case_vue六种l传输方式.md\":\"cadce3ad\",\"case_index.md\":\"4370ee15\",\"ai学习笔记_六、开发.md\":\"0b1a367a\",\"tools_前端基础知识.md\":\"864e9786\",\"ai学习笔记_三、promt工程.md\":\"1b5a7f7c\",\"办公_todo.md\":\"2ccf3c97\",\"日志_前端自检项.md\":\"0544de55\",\"case_基础csss样式.md\":\"d368d629\",\"tools_react.md\":\"d032d22f\",\"case_数字化大屏问题点.md\":\"e37019d4\",\"tools_php基础及常用函数.md\":\"b2afeccf\",\"case_flutter安装配置.md\":\"ccbc694e\",\"tools_js知识点.md\":\"51436346\",\"case_富文本编辑器原理.md\":\"f3b0b2ee\",\"tools_mysql命令.md\":\"373a1b6c\",\"tools_linux命令.md\":\"82c20701\",\"办公_前端常用代码.md\":\"8923abd6\",\"tools_jquery的使用.md\":\"e9d67fbd\",\"tools_docker使用.md\":\"1ea0c513\",\"tools_uniapp笔记.md\":\"c0a178f5\",\"tools_git笔记.md\":\"9870fad6\",\"日志_自媒体笔记.md\":\"0d283ba7\",\"tools_linux域名配置及反向代理.md\":\"25492670\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"阿泽的笔记\",\"description\":\"做一个努力的码农\",\"base\":\"/\",\"head\":[],\"appearance\":true,\"themeConfig\":{\"displayAllHeaders\":true,\"nav\":[{\"text\":\"首页\",\"link\":\"/\"},{\"text\":\"案例\",\"link\":\"/case/\"},{\"text\":\"工具\",\"link\":\"/tools/\"}],\"sidebar\":[{\"text\":\"工具\",\"collapsible\":true,\"collapsed\":true,\"items\":[{\"text\":\"adb命令\",\"link\":\"/tools/adb命令\"},{\"text\":\"arduino基础操作\",\"link\":\"/tools/arduino基础操作\"},{\"text\":\"cmd npm yarn pnpm命令\",\"link\":\"/tools/cmd npm yarn pnpm命令\"},{\"text\":\"elementUi笔记\",\"link\":\"/tools/elementUi笔记\"},{\"text\":\"Emmet Web快速构建命令\",\"link\":\"/tools/Emmet%20Web快速构建命令\"},{\"text\":\"git笔记\",\"link\":\"/tools/git笔记\"},{\"text\":\"js知识点\",\"link\":\"/tools/js知识点\"},{\"text\":\"linux命令\",\"link\":\"/tools/linux命令\"},{\"text\":\"linux域名配置及反向代理\",\"link\":\"/tools/linux域名配置及反向代理\"},{\"text\":\"mac使用笔记\",\"link\":\"/tools/mac使用笔记\"},{\"text\":\"mysql命令\",\"link\":\"/tools/mysql命令\"},{\"text\":\"php基础及常用函数\",\"link\":\"/tools/php基础及常用函数\"},{\"text\":\"react\",\"link\":\"/tools/react\"},{\"text\":\"uniapp笔记\",\"link\":\"/tools/uniapp笔记\"},{\"text\":\"vue笔记\",\"link\":\"/tools/vue笔记\"},{\"text\":\"前端基础知识\",\"link\":\"/tools/前端基础知识\"}]},{\"text\":\"案例\",\"collapsible\":true,\"collapsed\":true,\"items\":[{\"text\":\"css技巧\",\"link\":\"/case/css技巧\"},{\"text\":\"python自动测试脚本\",\"link\":\"/case/python自动测试脚本\"},{\"text\":\"uniapp踩坑记录\",\"link\":\"/case/uniapp踩坑记录\"},{\"text\":\"vuex使用示例\",\"link\":\"/case/vuex使用示例\"},{\"text\":\"vue六种l传输方式\",\"link\":\"/case/vue六种l传输方式\"},{\"text\":\"vue实例技巧\",\"link\":\"/case/vue实例技巧\"},{\"text\":\"优秀的开源vue组件\",\"link\":\"/case/优秀的开源vue组件\"},{\"text\":\"前端日志\",\"link\":\"/case/前端日志\"},{\"text\":\"开发富文本本编辑器\",\"link\":\"/case/开发富文本本编辑器\"},{\"text\":\"插件使用配置\",\"link\":\"/case/插件使用配置\"},{\"text\":\"样式布局\",\"link\":\"/case/样式布局\"},{\"text\":\"转pdf相关\",\"link\":\"/case/转pdf相关\"}]}]},\"locales\":{},\"scrollOffset\":90,\"cleanUrls\":false}");</script>
    
  </body>
</html>